package icangyu.base.utils;

public class ServerConfig {
    //库
    public static final String HOST_URL = "https://app.icangyu.com";     //Host
    public static final String TEST_URL = "http://testicy.icangyu.com";  //Debug
    public static final String BASE_URL;

    static {
        if(Configs.DEBUG) {
            boolean isTestServer = PreferenceUtil.getBoolean("isTestServer",true);
            BASE_URL = isTestServer?TEST_URL:HOST_URL;
        }else {
            BASE_URL = HOST_URL;
        }
    }



    public static String getBaseUrl() {
        return BASE_URL;
    }

    public static String getBaseUrl(String url){
        if(url == null)
            return BASE_URL;
        return url.startsWith("http")?url:(BASE_URL+url);
    }

    public static boolean isTestServer(){
        return BASE_URL == ServerConfig.TEST_URL;
    }

}
